package com.wars2d.client;

import java.util.ArrayList;
import java.util.HashMap;

import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class StaticObjectRenderer {
	
	static class StaticObject {
		float x, y;
		
		int id;
		
		public StaticObject(int id, float x, float y) {
			this.x = x;
			this.y = y;
			
			this.id = id;
		}
	}
	
	ArrayList<StaticObject> mActorList = new ArrayList<StaticObject>();
	
	HashMap<Integer, TextureRegion> mObjIdToTextureMap = new HashMap<Integer, TextureRegion>();
	
	public void addTextureRegion(int id, TextureRegion region) {
		if (!mObjIdToTextureMap.containsKey(id)) {
			mObjIdToTextureMap.put(id, region);
		}
	}
	
	public void addActor(int id, float x, float y) {
		mActorList.add(new StaticObject(id, x, y));
	}
	
	public void draw(SpriteBatch batch) {
		for (StaticObject obj : mActorList) {
			TextureRegion texture = mObjIdToTextureMap.get(obj.id);
			batch.draw(texture, obj.x, obj.y);
		}
	}
}
